package com.ruoyi.ring.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ring.domain.ActionRecord;
import com.ruoyi.ring.mapper.ActionRecordMapper;
import com.ruoyi.ring.service.IActionRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 行动Service业务层处理
 * 
 * @author liuwp
 * @date 2025-08-20
 */
@Service
public class ActionRecordServiceImpl implements IActionRecordService 
{
    @Resource
    private ActionRecordMapper actionRecordMapper;

    /**
     * 查询行动
     * 
     * @param id 行动主键
     * @return 行动
     */
    @Override
    public ActionRecord selectActionRecordById(Long id)
    {
        return actionRecordMapper.selectActionRecordById(id);
    }

    /**
     * 查询行动列表
     * 
     * @param actionRecord 行动
     * @return 行动
     */
    @Override
    public List<ActionRecord> selectActionRecordList(ActionRecord actionRecord)
    {
        return actionRecordMapper.selectActionRecordList(actionRecord);
    }

    /**
     * 根据业务主键查询一条记录：行动
     *
     * @param actionRecord 行动
     * @return 行动
     */
    @Override
    public ActionRecord selectOneActionRecord(ActionRecord actionRecord)
    {
        return actionRecordMapper.selectOneActionRecord(actionRecord);
    }

    /**
     * 新增行动
     * 
     * @param actionRecord 行动
     * @return 结果
     */
    @Override
    public int insertActionRecord(ActionRecord actionRecord)
    {
        actionRecord.setCreateTime(DateUtils.getNowDate());
        actionRecord.setUserId(SecurityUtils.getUserId());
        return actionRecordMapper.insertActionRecord(actionRecord);
    }

    /**
     * 修改行动
     * 
     * @param actionRecord 行动
     * @return 结果
     */
    @Override
    public int updateActionRecord(ActionRecord actionRecord)
    {
        actionRecord.setUpdateTime(DateUtils.getNowDate());
        return actionRecordMapper.updateActionRecord(actionRecord);
    }

    @Override
    public int updateActionRecordCondition(ActionRecord actionRecord, ActionRecord actionRecordCondition)
    {
                actionRecord.setUpdateTime(DateUtils.getNowDate());
        return actionRecordMapper.updateActionRecordCondition(actionRecord, actionRecordCondition);
    }

    /**
     * 批量删除行动
     * 
     * @param ids 需要删除的行动主键
     * @return 结果
     */
    @Override
    public int deleteActionRecordByIds(Long[] ids)
    {
        return actionRecordMapper.deleteActionRecordByIds(ids);
    }

    /**
     * 删除行动信息
     * 
     * @param id 行动主键
     * @return 结果
     */
    @Override
    public int deleteActionRecordById(Long id)
    {
        return actionRecordMapper.deleteActionRecordById(id);
    }

    /**
     * 条件删除行动
     *
     * @param actionRecord 行动
     * @return 结果
     */
    @Override
    public int deleteActionRecordByCondition(ActionRecord actionRecord)
    {
        return actionRecordMapper.deleteActionRecordByCondition(actionRecord);
    }

}
